<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with progress bar - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=progress+bar</link>
      <pubDate>Sun, 08 Aug 2021 19:06:47 +0000</pubDate>
         <description>Tagged with progress bar - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedprogress+bar/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Video tracking for progress bar using movie and ControlP5</title>
      <link>https://forum.processing.org/two/discussion/25606/video-tracking-for-progress-bar-using-movie-and-controlp5</link>
      <pubDate>Sun, 17 Dec 2017 06:55:17 +0000</pubDate>
      <dc:creator>Izzy280</dc:creator>
      <guid isPermaLink="false">25606@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I have been coding a progress bar using some examples that I found. The bar is almost done but it doesn't constantly update. Can someone assist me in getting it to update while the video is playing?
<a href="https://forum.processing.org/two/discussion/8103/using-a-controlp5-slider-as-video-progress-bar#latest" target="_blank" rel="nofollow">https://forum.processing.org/two/discussion/8103/using-a-controlp5-slider-as-video-progress-bar#latest</a>
`</p>

<pre><code>//using processing video and movie
import processing.video.*;
import controlP5.*;
import java.awt.geom.*;
ControlP5 cp5;
Movie movie;

boolean play;
int speed = 1;
int progress;

   void setup() {
   size(1280, 360);
   cp5 = new ControlP5(this);
    background(0);
    // Load and play the video in a loop
    movie = new Movie(this, "video.mov");
   movie.play();
    movie.speed(speed);

 //Progress Bar
  ProgressBar p;
  p = new ProgressBar(cp5, "progress"); 
 p.setPosition(130, 345).setSize(350, 10).setRange(0,  (int) 
movie.duration()).listen(true);
//callback listener for Timeline object
 p.addCallback(new CallbackListener() {
  public void controlEvent(CallbackEvent theEvent) {
   if(theEvent.getAction() == ControlP5.ACTION_PRESS) {
    float x = theEvent.getController().getPointer().x();
    float a1 = 0;
    float a2 = theEvent.getController().getWidth();
    float b1 = theEvent.getController().getMin();
    float b2 = theEvent.getController().getMax();
    float val = map(x,a1,a2,b1,b2);
    theEvent.getController().setValue(val);
    println("now change movie time to ", val, movie.time());
   movie.jump((float) val);
      }
    }
  }
  );
 // a toggle to switch between play and pause mode
 cp5.addToggle("play")
.setPosition(10,375)
.setSize(50,19)
.getCaptionLabel().align(CENTER,CENTER);
 }
  void movieEvent(Movie m) {
  m.read();
 }
 void draw() {
   if (play) {
   // update the progressBar value/position
   // replace with audio-track position: progress = player.position();

 image(movie, width/2, 0, width/2, height);

   if (movie.available()) movie.read();
   progress = (int) movie.time();
 }
  }
      class ProgressBar extends Controller&lt;ProgressBar&gt; {
      public ProgressBar(ControlP5 theControlP5, String theName) {
      super(theControlP5, theName);
      setView(new ControllerView&lt;ProgressBar&gt;() {

   public void display(PGraphics pg, ProgressBar c) {
     pg.fill(!isMouseOver() ? c.getColor().getForeground():c.getColor().getActive());
    pg.rect(0, 0, c.getWidth(), c.getHeight());

    float val = map(c.getValue(),c.getMin(), c.getMax(), 0, c.getWidth()); 
    pg.fill(255);
    pg.rect(0, 0, val, c.getHeight());
  }
}
);
}

     public ProgressBar setValue(float theValue) {
     return super.setValue(constrain(theValue, getMin(), getMax()));
 }

  public ProgressBar setRange(int theStart, int theEnd) {
  _myMin = theStart;
  _myMax = theEnd;
  return this;
  }
}
</code></pre>

<p>`</p>
]]></description>
   </item>
   <item>
      <title>Progress bar inside a calculation (for loop)</title>
      <link>https://forum.processing.org/two/discussion/25028/progress-bar-inside-a-calculation-for-loop</link>
      <pubDate>Wed, 15 Nov 2017 20:27:06 +0000</pubDate>
      <dc:creator>TheUltimateKrtek</dc:creator>
      <guid isPermaLink="false">25028@/two/discussions</guid>
      <description><![CDATA[<p>Hello, everyone!
I am working on a school project, photoshop.
When I use the blur effect it takes a very long time. So, I want to tell the user, how much progress has the algorithm made so far.
I have a single function doing all the work. Inside that function is a for loop and the most work is done inside that for loop.</p>

<p>The only values it is showing me are 0% and 100%.
I want to find a way to either draw the progress bar individually or redraw the whole screen inside that for loop.</p>

<p>Thx for help in advance.</p>
]]></description>
   </item>
   <item>
      <title>How to make a stamina/health/progress bar?</title>
      <link>https://forum.processing.org/two/discussion/20771/how-to-make-a-stamina-health-progress-bar</link>
      <pubDate>Mon, 13 Feb 2017 00:40:37 +0000</pubDate>
      <dc:creator>kevo1414</dc:creator>
      <guid isPermaLink="false">20771@/two/discussions</guid>
      <description><![CDATA[<p>Instead of a numbers (counter) I want to make a stamina bar but don't know how. I guess I can do this with rect() but don't know how to fill rect correctly? Any comment?</p>

<pre><code>float stamina = 1000;

float sprint = - (stamina / 1800); // 1 minute. 60 * frameRate
float running = - (stamina / 81000); // 45 minutes. 60 * 45 * frameRate
float walking = - (stamina / 216000); // 2h, 120 minutes. 60 * 120 * frameRate
float resting = (stamina / 216000);

String status = "Status: ";
String action;

int leftMargin = 5;


void setup() {
  size(640, 360);
  frameRate(30);
}

void draw() {
  background(0);

  if (stamina &lt;=0) {
    stamina = 0;
    fill(255, 0, 0);
    textAlign(CENTER);
    textSize(32);
    text("Stamina: " + (int) stamina, width/2, height/2);

    fill(255, 0, 0);
    textAlign(LEFT);
    textSize(16);
    text(status + "Out of stamina", leftMarging, 16);
  } else if (stamina &gt;= 1000) {
    stamina = 1000;
    fill(0, 255, 0);
    textAlign(CENTER);
    textSize(32);
    text("Stamina: " + (int) stamina, width/2, height/2);

    fill(0, 255, 0);
    textAlign(LEFT);
    textSize(16);
    text(status + "Full stamina", leftMargin, 16);
  } else {
    fill(255);
    textAlign(CENTER);
    textSize(32);
    text("Stamina: " + (int) stamina, width/2, height/2);

    textAlign(LEFT);
    textSize(16);
    text(status + action, leftMargin, 16);
  }

  textAlign(LEFT);
  textSize(11);
  fill(255);
  text("S = Sprinting", leftMargin, height - 90);
  text("R = Running / Jogging", leftMargin, height - 70);
  text("W = Walking", leftMargin, height - 50);
  text("ENTER = Resting", leftMargin, height - 30);
  text("SPACE = Reset", leftMargin, height - 10);

  if (keyCode == 83) {
    stamina = stamina + sprint;
    action = "Sprinting";
  } else if (keyCode == 82) {
    stamina = stamina + running;
    action = "Runnning / Jogging";
  } else if (keyCode == 87) {
    stamina = stamina + walking;
    action = "Walking";
  } else if (keyCode == 10) {
    stamina = stamina + resting;
    action = "Resting";
  } else if (keyCode == 32) {
    stamina = 1000;
  }
}
</code></pre>

<p></p>
]]></description>
   </item>
   <item>
      <title>Create progress bar for song.</title>
      <link>https://forum.processing.org/two/discussion/19440/create-progress-bar-for-song</link>
      <pubDate>Thu, 01 Dec 2016 01:00:28 +0000</pubDate>
      <dc:creator>jpnielsen</dc:creator>
      <guid isPermaLink="false">19440@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I'm trying to create a code that will play a song and have a bar created across the campus in relation to the player's position in the song. Right now I am able to create a line that moves across the screen, but I would like to be able to have a new line created every time the player moves, so it will eventually draw a bar. However, the drawing the bar part has me stumped. Would someone be able to help in how to make it so the line does not disappear?</p>

<p>Here is the code I have so far:</p>

<p>import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;</p>

<p>Minim minim;
AudioPlayer player;</p>

<p>void setup()
{
    size( 800, 600 );</p>

<pre><code>minim = new Minim( this );

player = minim.loadFile("Little Secrets.mp3");
player.play();
</code></pre>

<p>}</p>

<p>void draw()
{
    background( 255 );</p>

<pre><code>float x = map( player.position(), 0, player.length(), 0, width );

stroke( 0 );
strokeWeight (5);
line( x, 0, x, height );
</code></pre>

<p>}</p>

<p>void stop()
{
    player.close();
    minim.stop();
    super.stop();
}</p>
]]></description>
   </item>
   </channel>
</rss>